cmake_minimum_required(VERSION 3.5)
project(robot_chassis)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(CMAKE_BUILD_TYPE Debug)

INCLUDE_DIRECTORIES(
  ${CMAKE_CURRENT_SOURCE_DIR}/include/robot_chassis/
  ${CMAKE_CURRENT_SOURCE_DIR}/include/motor_driver/
)

# Finds dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)


add_executable(robot_chassis_node  src/robot_chassis_node.cpp
                                   src/robot_chassis.cpp
                                   src/chassis_kinematics.cpp
                                   src/motor_driver/can_open_driver.cpp
                                   src/motor_driver/motor_controller.cpp
                                   src/motor_driver/motor_control_utils.cpp)
ament_target_dependencies(robot_chassis_node rclcpp std_msgs geometry_msgs
                      sensor_msgs tf2 tf2_ros tf2_geometry_msgs nav_msgs)


install(TARGETS
robot_chassis_node
  DESTINATION lib/${PROJECT_NAME})

install(
  DIRECTORY launch config
  DESTINATION share/${PROJECT_NAME}
)

ament_package()
